package com.cookman.gameobjects;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.cookman.utils.AssetUtils;
import com.cookman.world.entities.Disease;

/**
 * Created by Cookman on 04.09.14.
 */
public class DiseaseActor {

    private Sprite black = AssetUtils.getDiseaseByColor(Disease.BLACK);
    private Sprite yellow = AssetUtils.getDiseaseByColor(Disease.YELLOW);
    private Sprite blue = AssetUtils.getDiseaseByColor(Disease.BLUE);
    private Sprite red = AssetUtils.getDiseaseByColor(Disease.RED);

    private float scale = 0.05f;

    public void draw(Batch batch, float x, float y, String color, int count) {
        if (count == 1) {
            batch.draw(getSpriteByColor(color), x, y, scale, scale);
        } else if (count == 2) {
            batch.draw(getSpriteByColor(color), x, y, scale, scale);
            batch.draw(getSpriteByColor(color), x + scale, y, scale, scale);
        } else if (count == 3) {
            batch.draw(getSpriteByColor(color), x, y, scale, scale);
            batch.draw(getSpriteByColor(color), x + scale / 2, y - scale / 2, scale, scale);
            batch.draw(getSpriteByColor(color), x - scale / 2, y - scale / 2, scale, scale);
        }
    }

    private Sprite getSpriteByColor(String color) {
        switch (color) {
            case Disease.BLACK:
                return black;
            case Disease.BLUE:
                return blue;
            case Disease.YELLOW:
                return yellow;
            case Disease.RED:
                return red;
        }
        return black;
    }
}
